<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>HexFiend: HFByteSlice Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">HexFiend
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Instance Methods</a> &#124;
<a href="interface_h_f_byte_slice-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">HFByteSlice Class Reference<div class="ingroups"><a class="el" href="group__model.html">Model</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>A class representing a source of data for an <a class="el" href="interface_h_f_byte_array.html" title="The principal Model class for HexFiend&#39;s MVC architecture. ">HFByteArray</a>.  
 <a href="interface_h_f_byte_slice.html#details">More...</a></p>
<div class="dynheader">
Inheritance diagram for HFByteSlice:</div>
<div class="dyncontent">
 <div class="center">
  <img src="interface_h_f_byte_slice.png" usemap="#HFByteSlice_map" alt=""/>
  <map id="HFByteSlice_map" name="HFByteSlice_map">
<area href="interface_h_f_file_byte_slice.html" title="A subclass of HFByteSlice for working data stored in files. " alt="HFFileByteSlice" shape="rect" coords="0,112,169,136"/>
<area href="interface_h_f_full_memory_byte_slice.html" title="A simple subclass of HFByteSlice that wraps an NSData. For most uses, prefer HFSharedMemoryByteSlice..." alt="HFFullMemoryByteSlice" shape="rect" coords="179,112,348,136"/>
<area href="interface_h_f_shared_memory_byte_slice.html" title="A subclass of HFByteSlice for working with data stored in memory. " alt="HFSharedMemoryByteSlice" shape="rect" coords="358,112,527,136"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Instance Methods</h2></td></tr>
<tr class="memitem:a145b439ab365eba8387f6f39c9558ad6"><td class="memItemLeft" align="right" valign="top">(unsigned long long)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_h_f_byte_slice.html#a145b439ab365eba8387f6f39c9558ad6">length</a></td></tr>
<tr class="separator:a145b439ab365eba8387f6f39c9558ad6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3c95912198358d73730de8aa53b56c01"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_h_f_byte_slice.html#a3c95912198358d73730de8aa53b56c01">copyBytes:range:</a></td></tr>
<tr class="separator:a3c95912198358d73730de8aa53b56c01"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a955b9f5a9ca54031c6d2b185c3adbef1"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interface_h_f_byte_slice.html">HFByteSlice</a> *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_h_f_byte_slice.html#a955b9f5a9ca54031c6d2b185c3adbef1">subsliceWithRange:</a></td></tr>
<tr class="separator:a955b9f5a9ca54031c6d2b185c3adbef1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a07d6bdb1e6133abd396792a6d4f7a174"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interface_h_f_byte_slice.html">HFByteSlice</a> *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_h_f_byte_slice.html#a07d6bdb1e6133abd396792a6d4f7a174">byteSliceByAppendingSlice:</a></td></tr>
<tr class="separator:a07d6bdb1e6133abd396792a6d4f7a174"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae09995093b464c0016dc1337dc5124df"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_h_f_byte_slice.html#ae09995093b464c0016dc1337dc5124df">isSourcedFromFile</a></td></tr>
<tr class="separator:ae09995093b464c0016dc1337dc5124df"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0bb3be9593aed4f2ddaa24b50ac818da"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="struct_h_f_range.html">HFRange</a>)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_h_f_byte_slice.html#a0bb3be9593aed4f2ddaa24b50ac818da">sourceRangeForFile:</a></td></tr>
<tr class="separator:a0bb3be9593aed4f2ddaa24b50ac818da"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5c49476fd844bb0f18621471f41981a3"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interface_h_f_byte_range_attribute_array.html">HFByteRangeAttributeArray</a> *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_h_f_byte_slice.html#a5c49476fd844bb0f18621471f41981a3">attributesForBytesInRange:</a></td></tr>
<tr class="separator:a5c49476fd844bb0f18621471f41981a3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a class="el" href="interface_h_f_byte_slice.html" title="A class representing a source of data for an HFByteArray. ">HFByteSlice</a> is an abstract class encapsulating primitive data sources (files, memory buffers, etc.). Each source must support random access reads, and have a well defined length. All HFByteSlices are <b>immutable</b>.</p>
<p>The two principal subclasses of <a class="el" href="interface_h_f_byte_slice.html" title="A class representing a source of data for an HFByteArray. ">HFByteSlice</a> are <a class="el" href="interface_h_f_shared_memory_byte_slice.html" title="A subclass of HFByteSlice for working with data stored in memory. ">HFSharedMemoryByteSlice</a> and <a class="el" href="interface_h_f_file_byte_slice.html" title="A subclass of HFByteSlice for working data stored in files. ">HFFileByteSlice</a>, which respectively encapsulate data from memory and from a file. </p>
</div><h2 class="groupheader">Method Documentation</h2>
<a id="a145b439ab365eba8387f6f39c9558ad6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a145b439ab365eba8387f6f39c9558ad6">&sect;&nbsp;</a></span>length()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (unsigned long long) length </td>
          <td></td>
          <td class="paramname"></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Return the length of the byte slice as a 64 bit value. This is an abstract method that concrete subclasses must override. </p>

</div>
</div>
<a id="a3c95912198358d73730de8aa53b56c01"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3c95912198358d73730de8aa53b56c01">&sect;&nbsp;</a></span>copyBytes:range:()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (void) copyBytes: </td>
          <td></td>
          <td class="paramtype">(unsigned char *)&#160;</td>
          <td class="paramname"><em>dst</em></td>
        </tr>
        <tr>
          <td class="paramkey">range:</td>
          <td></td>
          <td class="paramtype">(<a class="el" href="struct_h_f_range.html">HFRange</a>)&#160;</td>
          <td class="paramname"><em>range</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Copies a range of data from the byte slice into an in-memory buffer. This is an abstract method that concrete subclasses must override. </p>

</div>
</div>
<a id="a955b9f5a9ca54031c6d2b185c3adbef1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a955b9f5a9ca54031c6d2b185c3adbef1">&sect;&nbsp;</a></span>subsliceWithRange:()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (<a class="el" href="interface_h_f_byte_slice.html">HFByteSlice</a> *) subsliceWithRange: </td>
          <td></td>
          <td class="paramtype">(<a class="el" href="struct_h_f_range.html">HFRange</a>)&#160;</td>
          <td class="paramname"><em>range</em></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Returns a new slice containing a subrange of the given slice. This is an abstract method that concrete subclasses must override. </p>

</div>
</div>
<a id="a07d6bdb1e6133abd396792a6d4f7a174"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a07d6bdb1e6133abd396792a6d4f7a174">&sect;&nbsp;</a></span>byteSliceByAppendingSlice:()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (<a class="el" href="interface_h_f_byte_slice.html">HFByteSlice</a> *) byteSliceByAppendingSlice: </td>
          <td></td>
          <td class="paramtype">(<a class="el" href="interface_h_f_byte_slice.html">HFByteSlice</a> *)&#160;</td>
          <td class="paramname"><em>slice</em></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Attempts to create a new byte slice by appending one byte slice to another. This does not modify the receiver or the slice argument (after all, both are immutable). This is provided as an optimization, and is allowed to return nil if the appending cannot be done efficiently. The default implementation returns nil. </p>

</div>
</div>
<a id="ae09995093b464c0016dc1337dc5124df"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae09995093b464c0016dc1337dc5124df">&sect;&nbsp;</a></span>isSourcedFromFile()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (BOOL) isSourcedFromFile </td>
          <td></td>
          <td class="paramname"></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Returns YES if the receiver is sourced from a file. The default implementation returns NO. This is used to estimate cost when writing to a file. </p>

</div>
</div>
<a id="a0bb3be9593aed4f2ddaa24b50ac818da"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0bb3be9593aed4f2ddaa24b50ac818da">&sect;&nbsp;</a></span>sourceRangeForFile:()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (<a class="el" href="struct_h_f_range.html">HFRange</a>) sourceRangeForFile: </td>
          <td></td>
          <td class="paramtype">(<a class="el" href="interface_h_f_file_reference.html">HFFileReference</a> *)&#160;</td>
          <td class="paramname"><em>reference</em></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>For a given file reference, returns the range within the file that the receiver is sourced from. If the receiver is not sourced from this file, returns {ULLONG_MAX, ULLONG_MAX}. The default implementation returns {ULLONG_MAX, ULLONG_MAX}. This is used during file saving to to determine how to properly overwrite a given file. </p>

</div>
</div>
<a id="a5c49476fd844bb0f18621471f41981a3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5c49476fd844bb0f18621471f41981a3">&sect;&nbsp;</a></span>attributesForBytesInRange:()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (<a class="el" href="interface_h_f_byte_range_attribute_array.html">HFByteRangeAttributeArray</a> *) attributesForBytesInRange: </td>
          <td></td>
          <td class="paramtype">(<a class="el" href="struct_h_f_range.html">HFRange</a>)&#160;</td>
          <td class="paramname"><em>range</em></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Returns the attributes for the bytes in the given range. </p>

<p>Provided by category <a class="el" href="category_h_f_byte_slice_07_h_f_attributes_08.html#a5c49476fd844bb0f18621471f41981a3">HFByteSlice(HFAttributes)</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="_h_f_byte_slice_8h_source.html">HFByteSlice.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.12
</small></address>
</body>
</html>
